<?php
class Model_Packet extends MVC_MODEL {
	/**
	 * @var object SQL
	 */
	public $oDb_Packet;
//	private $aData = array();
	
	public function __construct(){
		parent::__construct();
		$this->oDb_Packet = new Db_Packet();
	}
	public function setDataPacket($fileUpload){
		$this->setData('packet_name',$_REQUEST[packet_name]);
		$this->setData('packet_description',$_REQUEST[packet_description]);
		$this->setData('packet_image',$fileUpload);
		$this->setData('packet_download_items',$_REQUEST[packet_download_items]);
		$this->setData('packet_period',$_REQUEST[packet_period]);
		$this->setData('packet_price',$_REQUEST[packet_price]);
		$this->setData('packet_status',$_REQUEST[packet_status]);
		return $this->aData;
	}
	public function insertPacket($fileUpload){
		$aData = $this->setDataPacket($fileUpload);
		 $this->oDb_Packet->doInsertPacket($aData);
	}
	public function listPacket(){
		$this->oDb_Packet->doListPacket();
		return $this->oDb_Packet;
	}
	public function deletePacketById($id){
		$this->oDb_Packet->doDeletePacketById($id);
//		return $this->oDb_Packet;
	}
	public function getPacketById($id){
		return $this->oDb_Packet->doGetPacketById($id);
//		return $this->oDb_Packet;
	}
	public function updatePacketByID($fileUpload, $id){
		$aData = $this->setDataPacket($fileUpload);
		$this->oDb_Packet->doUpdatePacketById($aData,$id);
	}
        public function getListActive(){
                $this->oDb_Packet->doListPacketActive();
		return $this->oDb_Packet;
        }
        public function doInsertTrans($aData){
                return $this->oDb_Packet->doInsertTrans($aData);
        }
}
?>
	